package com.zntg.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
    @Bean(value = "defaultApi")
    public Docket defaultApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(groupApiV2Info())
                .groupName("CRM附件中心接口文档")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.zntg.api"))
                .paths(PathSelectors.any())
                .build();
    }


    private ApiInfo groupApiV2Info(){
        return new ApiInfoBuilder()
                .title("CRM附件中心接口文档")
                .description("CRM附件中心接口文档<br>包括认购书生成，app附件同步到crm，双录附件同步到crm功能")
                .termsOfServiceUrl("http://10.0.10.33/")
                .contact("zhengyunfei@ylcaifu.com")
                .version("2.0")
                .build();
    }
    @Bean(value = "dianzizhengshuRestApi")
    public Docket dianzizhengshuRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(getRgBook())
                .groupName("认购书")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.yunfei.api"))
                .paths(PathSelectors.any())
                .build();
    }
    private ApiInfo getRgBook(){
        return new ApiInfoBuilder()
                .title("认购书接口文档")
                .description("认购书接口文档")
                .termsOfServiceUrl("http://10.0.100.33")
                .contact("zhengyunfei@ylcaifu.com")
                .version("1.0")
                .build();
    }
}
